//
//  HSYRequest.h
//  HSY
//
//  Created by 陈浩 on 2017/3/31.
//  Copyright © 2017年 金开门. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HSYResponse.h"
#import "HSYFileModel.h"

typedef void (^HSYSuccessHandler)(HSYResponse *response);
typedef void (^HSYErrorHandler)(NSError *error);
typedef void (^HSYCompletionHandler)(id responseObject, NSString *resultString);

@interface HSYRequest : NSObject

@property (nonatomic, copy) HSYSuccessHandler success;
@property (nonatomic, copy) HSYErrorHandler failure;
@property (nonatomic, weak) NSURLSessionTask *task;
@property (nonatomic, copy, readonly) NSArray<HSYFileModel *> *files;

- (NSDictionary *)buildUrlParams;
- (NSDictionary *)requestData;
- (NSString *)serviceCode;
- (NSArray<HSYFileModel *> *)files;
- (BOOL)needAccessToken; //需要附带token

- (BOOL)isRunning;
- (void)cancelCurrentTask; //取消请求

- (void)addFile:(NSData *)file withFileName:(NSString *)fileName toArray:(NSMutableArray *)array;

- (BOOL)fileUplaod;

@end
